-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add forbid-in-block-sequences feature for detecting empty values in block sequences #604
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Éric, and thanks for contributing to yamllint!
For consistency with YAML vocabulary and already-existing yamllint options forbid-in-block-mappings
and forbid-in-flow-mappings
, this new feature should be named forbid-in-block-sequences
(and a new option forbid-in-flow-sequences
shouldn't be necessary because I believe [1, , 3]
is invalid YAML syntax). Same for the documentation paragraph, the LintProblem
message and test functions names.
Since the rule empty-values
is disabled in default and relaxed configurations, I would set this option enabled by default, like forbid-in-block-mappings
and forbid-in-flow-mappings
are. It will create new errors or warnings for some users with specific configurations, but it's easy to fix. What do you think?
Hello! Thank you so much for the code review, In response to the valuable feedback provided, I have made the following changes:
In addition to these changes, I've also added more test cases to cover various scenarios. However, due to the Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks perfect, thank you! I'm merging this so it goes in the next yamllint release.
empty-values
rule is enabled in your configuration. But if it's the case, you probably want this new option forbid-in-block-sequences
enabled too, for consistency. In case you want to disable it, just use this configuration in your .yamllint
:
rules:
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
forbid-in-block-sequences: false
feat: Add
forbid-in-list-items
feature to detect empty values in listsThis commit introduces a new feature,
forbid-in-list-items
, which allows users to check for empty values within lists. The default behavior is set tofalse
, but it can be activated by setting theforbid-in-list-items
configuration variable totrue
.The
check
function has been updated to handle this feature, and it will now identify and report empty values within list items whenforbid-in-list-items
is enabled.This enhancement provides users with more control and flexibility when using the linter for YAML files.